package team.bailan.controller.card;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import team.bailan.common.config.ReturnResponse;
import team.bailan.entity.dto.PlayerInfDTO;
import team.bailan.entity.dto.RoomInfDTO;
import team.bailan.entity.vo.InitialCardVO;
import team.bailan.service.CardService;

@RestController
@RequestMapping("api/card")
public class CardController {
    @Autowired
    public CardService cardService;

    @ApiOperation("获取对应player的初始牌")
    @PostMapping("farmer")
    public ReturnResponse<InitialCardVO> getInitialCards(@RequestBody PlayerInfDTO playerInfDTO) {
        return cardService.getInitialCards(playerInfDTO);
    }

    @ApiOperation("获取地主的三张牌")
    @PostMapping("lord")
    public ReturnResponse<InitialCardVO> getLordCards(@RequestBody PlayerInfDTO playerInfDTO) {
        return cardService.getLordCards(playerInfDTO);
    }

    @ApiOperation("重新发牌")
    @PostMapping("refresh")
    public ReturnResponse<String> refresh(@RequestBody RoomInfDTO roomInfDTO) {
        return cardService.refresh(roomInfDTO);
    }
}
